
 
<table width="100%">
<tr align="center">
<td bgcolor="" style="color:#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="30%" align="left">  <a href="<?php echo $_SERVER["PHP_SELF"] . "?m=". $p_month . "&y=" . $p_year; ?>" style="color:black">Prev</a></td>
<td width="40%" align="center">  <a href="<?php echo $_SERVER["PHP_SELF"] . "?m=". date("m") . "&y=" . date("y"); ?>" style="color:black">Current</a></td>
<td width="30%" align="right"><a href="<?php echo $_SERVER["PHP_SELF"] . "?m=". $n_month . "&y=" . $n_year; ?>" style="color:black">Next</a>  </td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<table width="100%"  border="1" cellpadding="2" cellspacing="2">
<tr align="center">
<td colspan="8" bgcolor="green" style="color:#FFFFFF"><B><?php echo $monthNames[$currentMonth-1].' '.$currentYear; ?></B></td>
</tr>
<tr >

<?php for($i=1;$i<=7;$i++){ ?>
 
<td align="center" height='30' bgcolor="" style="color:black"><B><?php echo $days[$i]; ?></B></td>
 
<?php } ?>
<td align='center' bgcolor='green'><b>Wk</b></td>
</tr>
<?php
$timestamp = mktime(0,0,0,$currentMonth,1,$currentYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
$c = 0;
$daySave = 0;
$bgcolor = "";
for ($i=0; $i<($maxday+$startday); $i++) {
    if(($i % 7) == 0 ) echo "<tr>";
    if($i < $startday) echo "<td >&nbsp;</td>";
    else {
		$chkDay = $i - $startday + 1;
		$bX = time();
		$refDay = date("d", $bX);
		if ($refDay == $chkDay) {$bgcolor='green';}
		echo "<td align='center'    height='28' valign='middle' bgcolor='$bgcolor' height='20px'>". ($chkDay) . "</td>";
		$bgcolor = "";
	}
	$c = $i %7;
	$timestampX = mktime(0,0,0,$currentMonth,$i - $startday + 1,$currentYear);
	$wkNo = date("W", $timestampX);
	$daySave = $i - $startday + 1;
    if(($i % 7) == 6 ) echo "<td align='center' bgcolor='green'>$wkNo</td></tr>";
	
	
}
$d = 7 - ($c + 1);
for($x=0;$x<$d;$x++) {
	print "<td>&nbsp;</td>";
}
$timestampX = mktime(0,0,0,$currentMonth,$daySave,$currentYear);
$wkNo = date("W", $timestampX);
if ($c != 6) print "<td align='center' bgcolor='green'>$wkNo</td>";
?>
</tr>
</table>
</td>
</tr>
</table>